package nl.utwente.csc.obsl.diagram.extension.figure;


import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.sirius.diagram.ui.tools.api.figure.StyledFigure;

public class PhaseFigure extends Shape implements StyledFigure {
	final Rectangle r = new Rectangle();
	final PointList line = new PointList();
	final Rectangle r2 = new Rectangle();
	
	
	 protected void outlineShape(final Graphics graphics) {
		 set();
		  graphics.drawArc(r, 90, 180);
		 graphics.drawPolyline(line);

	 }
	 
	 protected void fillShape(final Graphics graphics) {
		 set();
		 graphics.fillArc(bounds,90,180);
		 graphics.fillRectangle(r2);
	 }
		 
	public PhaseFigure() {
		

	}	
	protected void set() {

		r.x = bounds.x + getLineWidth() / 2;
		r.y = bounds.y + getLineWidth() / 2;
		r.width = bounds.width - getLineWidth();
		r.height = bounds.height - getLineWidth();
		
		line.removeAllPoints();;
		line.addPoint(r.x + r.width/2,     r.y);
		line.addPoint(r.x + r.width,     r.y);
		line.addPoint(r.x + r.width,     r.y + r.height);
		line.addPoint(r.x + r.width/2,     r.y + r.height);
		
		r2.x = bounds.x+bounds.width/2;
		r2.y = bounds.y;
		r2.width = bounds.width/2;
		r2.height = bounds.height;
	}
	
	

}